<template>
  <div>
    <span >
        <router-link to="/home/WelCome" class="home">首页</router-link>
    </span>
    <span>></span>
    <span>{{name1}}</span>
    <span>></span>
    <span>{{name2}}</span>
  </div>
</template>

<script>
export default {
    name:'indexhead',
    data() {
        return {
            name1:sessionStorage.getItem('name1')||'',
            name2:sessionStorage.getItem('name2')||'',
        };
    },
    mounted(){
        // console.log(sessionStorage.getItem('name1'),sessionStorage.getItem('name2'));
        this.$bus.$on('demo',this.accept)
    },
    methods:{
        accept(name){
            this.name1 = name.name1
            this.name2 = name.name2
            // console.log(name.name1,name.name2);
        }
    }
}
</script>

<style scoped>
.home{
    cursor:pointer;
    font-weight: 700;
    font-size: 18px;
    text-decoration: none ;
    color: black;
    
}
span{
    margin-right: 10px;
}
div{
    margin-bottom: 20px;
}
</style>